/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.curso.service;

import com.curso.model.User;
import java.util.ArrayList;

/**
 *
 * @author gaston nieto
 * 
 */
public class UserService extends GenericService<User,Long> {
    
    public User save(User user){
        
        String mail = user.getEmail();
        String mailLastPart = mail.substring(mail.indexOf("@"));
        
        if(user.getName().length()>2 && user.getPassword().length()>5 
                && user.getUserName().length()>2 && user.getAddress()!=null
                && user.getPhoneNumber()!=null){
            
                if(mailLastPart!=null && mailLastPart.endsWith(".com") &&
                        mailLastPart.length()>5){
                    
                        return user;
                }
        }
        return null;
    }
    
    public void removeUser(String userId) {
        //ToDo
    }
    
    @Override
    public User save() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Boolean remove() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Boolean update() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public User get(Long id) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public ArrayList getAll() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    

}
